<%--
  Created by IntelliJ IDEA.
  User: MSI-CN
  Date: 2021/5/19
  Time: 16:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工作笔记</title>
    <link rel="stylesheet" href="static/css/bootstrap.css">
    <style>
        #box {
            width: 800px;
            margin: 50px auto;
            /*color: #e0e0e0;*/
        }

        table {
            height: 20%;
            text-align: center;
            border: 1px solid #cccccc;
        }

        th {
            text-align: center;
        }

        #box p {
            text-align: center;
        }
    </style>
</head>
<body>
<div id="box">
    <table border="1px" class="table">
        <tr>
            <th colspan="5">工作笔记</th>
        </tr>
        <tr>
            <th>标题</th>
            <th>类型</th>
            <th>时间</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${allInfo}" var="item">
        <tr>
            <td>${item.title}</td>
            <td>${item.typeName}</td>
            <td>${item.date}</td>
            <td><a id="${item.id}" href="JavaScript:;">查看</a></td>
        </tr>
        </c:forEach>
    </table>
    <p>
        <button class="btn btn-primary" id="add">添加关键词</button>
    </p>
</div>
<script src="static/js/jquery-3.5.1.js"></script>
<script>
    $(function (){
        $("a").click(function (){
            let obj=$(this);
            window.location.href="getByID/"+obj.attr("id");
        });
        $("#add").click(function () {
            window.location.href="toAddPage";
        });
        $("tr:gt(1):even").css({backgroundColor:"#e0e0e0"})
    });
</script>
</body>
</html>